#pragma once

namespace	MomogenkyouSystem	{
//--------------------------------------------------------------------------------------
// Callback structure
//--------------------------------------------------------------------------------------
class StreamingVoiceContext : public IXAudio2VoiceCallback
{
public:
	HANDLE BufferEndEvent;

	STDMETHOD_( void, OnVoiceProcessingPassStart)	(UINT32 BytesRequired);
	STDMETHOD_( void, OnVoiceProcessingPassEnd)		();
	STDMETHOD_( void, OnStreamEnd)					();
	STDMETHOD_( void, OnBufferStart)				(void * pBufferContext);
	STDMETHOD_( void, OnBufferEnd)					(void * pBufferContext);
	STDMETHOD_( void, OnLoopEnd)					(void * pBufferContext);
	STDMETHOD_( void, OnVoiceError)					(void * pBufferContext, HRESULT Error);

    StreamingVoiceContext();
    virtual ~StreamingVoiceContext();
};


//--------------------------------------------------------------------------------------
// Wavebank
//--------------------------------------------------------------------------------------
class Wavebank
{
	WAVEBANKHEADER		m_Header;
	WAVEBANKDATA		m_Data;
	WAVEBANKENTRY	*	m_pEntries;
public:
    Wavebank();
    virtual ~Wavebank();

	HRESULT Load(const std::string & Filename);
    void    Release();

    DWORD   GetEntryCount() const;
    DWORD   GetEntryLengthInBytes(DWORD index);
    DWORD   GetEntryOffset(DWORD index);
    HRESULT GetEntryFormat(DWORD index, WAVEFORMATEX* pFormat);
};

}